Applications of Queue in Python